//@代表src目录,es6引入模块语法
import http from '@/http/http';

const url = 'products';

export default {
  getByPage(data, params) {
    return http.post(`${url}/list.do`, data, {
      params,
    });
  },
  getBy(pid) {
    return http.get(`${url}/getlist.do`, {
      params: {
        pid,
      },
    });
  },
  del(id) {
    return http.get(`${url}/del.do`, {
      params: {
        id,
      },
    });
  },
  delBatch(ids) {
    return http.get(`${url}/delBatch.do`, {
      params: {
        ids,
      },
    });
  },
  save(data) {
    return http.post(`${url}/save.do`, data);
  },
  edit(id) {
    return http.get(`${url}/edit.do`, {
      params: {
        id,
      },
    });
  },
  checkcid(cid) {
    return http.get(`check/checkcid.do`, {
      params: {
        cid,
      },
    });
  },
  pay(id, num) {
    return http.get(`${url}/pay.do`, {
      params: {
        num,
        id,
      },
    });
  },
};
